<?php   
//Set values for page
$page_title = "Profile";
$current_page = "profile";
require_once 'global.inc.php';
  
//check to see if they're logged in
if(!isset($_SESSION['logged_in'])) {
	header("Location: login.php");
}

//get the user object from the session 
$user = unserialize($_SESSION['user']); 

//initialize php variables used in the form 
$email = $user->email; 
$message = ""; 

//check to see that the form has been submitted 
if(isset($_POST['submit-settings'])) {

	//retrieve the $_POST variables
	$email = $_POST['email'];

	$user->email = $email;
	$user->save();

	$message = "Settings Saved<br/>";
}

//If the form wasn't submitted, or didn't validate  
//then we show the registration form again  
?>
<!DOCTYPE html>
<html lang="en">
	<?php include 'includes/header.php';?>
<body>
	<?php include 'includes/menu.php';?>
	<?php //include 'includes/slideshow.php';?>
	<div class="container" style="margin-top:60px;">
		<div class="row">
			<div class="span12">
				<?php echo $message; ?>  
				<form action="profile.php" method="post">  
					<label class="" for="billing_email">Email Address </label>
					<input id="billing_email" type="text" value="<?php echo $email; ?>" name="email" />
					<div>
						<input type="submit" value="Update" name="submit-settings" />
					</div>
				</form>
			</div>
		</div>
	</div>
	<?php include 'includes/footer.php';?>
	<!-- javascript -->
	<script src="js/jquery.js"></script>
	<script src="js/bootstrap.js"></script>
	</body>
</html>